#include <stdio.h>

int    evaluation(int n,int a) ;
int main()
{
       int        n , a ; 

       scanf("%d%d",&n,&a);       
       printf("%d\n",evaluation(n,a));

    return 0;
}

int    evaluation(int n,int a)
{
    int rt;
    if(n==-1) rt=1;
    else rt=a*evaluation(n-1,a)+1;
    return rt;
}